/*
 * @lc app=leetcode.cn id=1759 lang=golang
 *
 * [1759] 统计同构子字符串的数目
 */
package Solutions

// @lc code=start
func countHomogenous(s string) (ans int) {
	count := 1
	for i := 1; i < len(s); i++ {
		if s[i] == s[i-1] {
			count++
		} else {
			ans = (ans + (count+1)*count/2) % (1e9 + 7)
			count = 1
		}
	}
	ans = (ans + (count+1)*count/2) % (1e9 + 7)
	return
}

// @lc code=end
